﻿#ifndef MACHINETYPEFUN_H
#define MACHINETYPEFUN_H

#include <QObject>
#include <QTextCodec>
#include "items/itemsmanage.h"
#include "main.h"
#include <QHash>

enum PATTERNINFO{
    FileName,//文件名
    Index,//针数索引
    Schedule,//进度
    BeginPoint,//起始点
    LocalPoint,//定位点
    Range,//范围
    Position,//位置
    ZCoor,//Z坐标
    Production//产量
};

class MachineTypeFun : public QObject
{
    Q_OBJECT
public:
    explicit MachineTypeFun(QObject *parent = 0);

public:
    virtual ~MachineTypeFun();

public:
    virtual QList <ParaItem> getParasListByMcSel();
    virtual QList <OutCtrlItem> getOutCtrlListByFilter();
    virtual QList <ShortCutItem> getShortCutListByFilter();
    virtual QList <AssistItem> getAssistListByFilter();
    virtual QList <PatternSetItem> getPatternSetListByFilter();
    virtual QList <ParaSetItem> getParaSetListByFilter();
    virtual QList <SensorItem> getSensorList();
    virtual QList <ErrorCodeStateItem> getErrorCodeAndStateList();
    virtual const QHash<int,NineItem>& getNinebtn();
    virtual const QList<PATTERNINFO>& getFileInfoMSG();
    virtual void initNinebtn1234() = 0;
    virtual void initFileInfoLabel();

protected:
    virtual void initRootParasList();//超级用户参数(包括机器参数、工作参数)
    OutCtrlItem creatOpenCloseItem(int macType, int showPriority, QString name, int def);//打开关闭(放松,夹紧)
    OutCtrlItem creatZeroForwardReverseItem(int macType, int showPriority, QString name, int def);//(归零,正转,反转)
    OutCtrlItem creatAscendingDescendingItem(int macType, int showPriority, QString name, int def);//(上升,下降)
    OutCtrlItem creatEnableItem(int macType, int showPriority, QString name, int def, QString btnName);//(剪线)
    OutCtrlItem creatZeroItem(int macType, int showPriority, QString name, int def);//	(正转):转动
    OutCtrlItem creatALLItem(int macType, int showPriority, QString name, int def);//(归零,使能，失能，正转,反转)
    OutCtrlItem creatNoZeroItem(int macType, int showPriority, QString name, int def);//(使能，失能,正转,反转)
    OutCtrlItem creatReleaseTightenItem(int macType, int showPriority, QString name, int def);//(放松，收紧)

public:
    QList <ParaItem> m_allParasList;
    QList <OutCtrlItem> m_allOutCtrlList;

    QList <ShortCutItem> m_allShortCutList;
    QList <AssistItem> m_allAssistList;
    QList <PatternSetItem> m_allPatternSetList;
    QList <ParaSetItem> m_allParaSetList;
    QList <SensorItem> m_allSensorList;
    QList <ErrorCodeStateItem> m_allErrorCodeAndStateList;

    QList <OutCtrlItem> m_allMotorCtrlList;//电机动作
    QList <OutCtrlItem> m_allCylinderCtrlList;//气缸动作

protected:
    QHash<int,NineItem> m_nineBtn;    //九宫格四角按钮的机型化配置
    QList<PATTERNINFO> m_fileInfo;//右上角花样信息显示
private:
    void initAllSensorList();//初始化全部传感器列表

protected:
    QString enableStr;   //使能
    QString disableStr; //失能
    QString jogPStr; //正转
    QString jogNStr; //反转
    QString turnStr; //转动
    QString zeroStr; //归零
    QString openStr; //打开
    QString closeStr;//关闭
    QString ascendStr;//上升
    QString descendStr;//下降
    QString release;//释放
    QString tighten;//收紧
    QString trimStr;//剪线
    QString action;//动作
    QString stop;//停止
    QString pulStr;//拉料
    QString backStr;//退料
    QString stretchStr;//伸出
    QString recoverStr;//收回
    QString stopStr;//停止
    QString swingoneStr;//摆动位1
    QString swingtwoStr;//摆动位2
    QString runStr;//执行
};

#endif // MACHINETYPEFUN_H
